package com.zf.yichat.service.impl;

import com.zf.yichat.mapper.UserReportMapper;
import com.zf.yichat.model.UserReport;
import com.zf.yichat.service.UserReportService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 *
 */
@Service
public class UserReportServiceImpl implements UserReportService {

    @Resource
    private UserReportMapper userReportMapper;

    @Override
    public void save(Integer type, String content, Long id, Long userId) {

        UserReport report = new UserReport();
        report.setType(type);
        report.setContent(content);
        report.setTargetId(id);
        report.setUserId(userId);

        userReportMapper.insertSelective(report);
    }

    @Override
    public List<UserReport> getReports() {
        List<UserReport> userReports = userReportMapper.selectAll();
        return userReports;
    }
}
